<%@ page contentType="text/html; charset=GBK"  %>
<%@page import="java.util.*"%>
<%@page import="com.ionglobal.db.*" %>
<%@page import="com.ionglobal.misc.*" %>
<%@page import="com.ionglobal.lib.*" %>
<%@page import="com.gzgi.weqs.compenmanage.*" %>
<%@page import="com.gzgi.weqs.common.ResultsetToJson"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ include file="/include/init_include.jsp" %>
<%
	int pageid = Request.getParameterInt("pageid", 0);
	int pagesize = Request.getParameterInt("pagesize", 20);
	String supplierNo = Request.getString("supplierNo","");
	String contractNo = Request.getParameter("contractNo", "");
	String priceType = Request.getParameter("priceTypeCode","");
	String effectDate = Request.getParameter("effectDate","");
	
	
	String sql = "select pa.* from pqm_priceAgreement pa where 1=1";
	if(supplierNo!=null && StringUtils.isNotEmpty(supplierNo)){
		sql += " and pa.ssupplierNo='"+supplierNo+"'";
	}
	if(contractNo!=null && StringUtils.isNotEmpty(contractNo)){
		sql += " and pa.scontractNo like '%"+contractNo+"%'"; 
	}

	if(priceType!=null && StringUtils.isNotEmpty(priceType)){
		sql += " and pa.spriceType = '"+priceType+"'";
	}
	if(effectDate!=null && StringUtils.isNotEmpty(effectDate)){
		sql += " and pa.dtakeeffectdate = '"+effectDate+"'";
	}

	ResultsetToJson jsonTool = new ResultsetToJson();
	String jsonString = jsonTool.getStringJsonOrderBy(dbi, sql, "pa.iId", "ASC", pageid, pagesize);

	out.println(jsonString);
%>
<%@ include file="/include/init_free.jsp" %>